The code below is to convert int to an integer, as well as an integer to a BigInteger. This example uses the namespace java.math.
import java.math.BigInteger; public class IntConvertor{ public static void main(String[] args) { int input = 10; //Print out System.out.println(input); // convert int to Integer Integer integer = Integer.valueOf(input); //Print out System.out.println(integer); // convert int to BigInteger BigInteger bigInteger = BigInteger.valueOf(input); //Print out System.out.println(bigInteger); } }
Output
10
10
10
Related Articles
Replace hostname in URL using C#
Comments